<?php
include("connection/connection.php");
if(isset($_POST['submit']))
{

$loc_id=$_POST['loc_id'];
$code=$_POST['code'];
if($code==1)
{
//echo "sfsfsf";
$qr="insert into tbl_dtls_q1_reserv (id,loc_id,reserv_id,reserv_location,reserv_latitude,reserv_longitude,	reserv_cap,reserv_scst,status)values('','$loc_id','CWR','$_REQUEST[Location]','$_REQUEST[Latitude]','$_REQUEST[Longitude]','$_REQUEST[cap]','$_REQUEST[scst]','1')";
}
if($code==2)
{
$qr="insert into tbl_dtls_q1_reserv (id,loc_id,reserv_id,reserv_location,reserv_latitude,reserv_longitude,	reserv_cap,reserv_scst,status)values('','$loc_id','GLSR','$_REQUEST[Location]','$_REQUEST[Latitude]','$_REQUEST[Longitude]','$_REQUEST[cap]','$_REQUEST[scst]','1')";
}
if($code==3)
{
$qr="insert into tbl_dtls_q1_reserv (id,loc_id,reserv_id,reserv_location,reserv_latitude,reserv_longitude,	reserv_cap,reserv_scst,status)values('','$loc_id','GLR','$_REQUEST[Location]','$_REQUEST[Latitude]','$_REQUEST[Longitude]','$_REQUEST[cap]','$_REQUEST[scst]','1')";
}
if($code==4)
{
$qr="insert into tbl_dtls_q1_reserv (id,loc_id,reserv_id,reserv_location,reserv_latitude,reserv_longitude,	reserv_cap,reserv_scst,status)values('','$loc_id','OHSR','$_REQUEST[Location]','$_REQUEST[Latitude]','$_REQUEST[Longitude]','$_REQUEST[cap]','$_REQUEST[scst]','1')";
}

$res=mysql_query($qr);
if($res)
{
if($code==1)
{
$update_query="update tbl_dtls_q1_main set cwr_total=(cwr_total+1) where id='$loc_id'";
}
if($code==2)
{
$update_query="update tbl_dtls_q1_main set glsr_total=(glsr_total+1) where id='$loc_id'";
}
if($code==3)
{
$update_query="update tbl_dtls_q1_main set glr_total=(glr_total+1) where id='$loc_id'";
}
if($code==4)
{
$update_query="update tbl_dtls_q1_main set ohsr_total=(ohsr_total+1) where id='$loc_id'";
}

$res=mysql_query($update_query);
header("location:q1_rwss_edit.php");
}
}		
?>